The technology described herein relates to a method of and apparatus for storing an encoded block of data in memory. It also relates to the corresponding method of and apparatus for retrieving data for an encoded block of data from memory.
It is common to encode arrays of data elements, such as arrays of graphics data values (e.g. frames for display or graphics textures), so as to compress the data in order to reduce bandwidth and memory consumption. This is particularly desirable in data processing apparatus, e.g. of portable devices, where processing resources and processing power may be limited.
Arrays of data elements are often divided into smaller blocks of data elements and then encoded or decoded on a block by block basis. This can allow partial updating of, or random access to, data elements of the encoded array without needing to encode or decode the entire array each time a data element needs to be updated or accessed. This is particularly the case, for example, in graphics processing apparatus where partial updating of a frame or random access into a texture may be desired.
In some arrangements, the blocks of data elements for an array of data elements may compress by differing degrees, and thus the encoded versions of those blocks of data elements may be different data sizes to one another. For example, blocks of substantially uniform data values (e.g. substantially uniform appearance or colour) tend to compress well, whereas blocks of highly varied data values tend not to compress so well. Thus, the size of the encoded versions of the blocks of data elements may not be known in advance of the encoding scheme being applied to the original unencoded blocks of data elements.
Also, in some arrangements the encoded blocks of data for an array of data elements may be stored arbitrarily at substantially any location in memory. This can allow the encoded blocks to be stored in memory in a flexible way, e.g. by reusing memory that is no longer needed and/or by not leaving substantial areas of unused memory.
However, the above arrangements generally mean that the encoded blocks of data are not at predictable locations in memory.
In the above arrangements, headers may be provided for the encoded blocks of data, with the headers being stored at predictable locations in memory and indicating the locations of the encoded blocks of data. These headers are typically stored contiguously in memory based on a scan-line or raster order that traverses the corresponding blocks of the array. In these arrangements, when a particular encoded block is required for decoding, the location of the header for that encoded block can readily be determined from the scan-line and distance along the scan-line of the corresponding block in the array. The header can then be read so as to determine the location of its encoded block. The encoded block of data can then be read from memory for decoding.
The Applicants believe that there remains scope for improved arrangements for storing encoded blocks of data in memory.
The drawings show elements of a data processing apparatus and system that are relevant to embodiments of the technology described herein. As will be appreciated by those skilled in the art there may be other elements of the data processing apparatus and system that are not illustrated in the drawings. It should also be noted here that the drawings are only schematic, and that, for example, in practice the shown elements may share significant hardware circuits, even though they are shown schematically as separate elements in the drawings.